# -*- encoding: utf-8 -*-
from shapely.wkt import loads as wkt_loads
import dsl
from . import FixtureTest


class PredictableLayersPois(FixtureTest):
    def test_grave_yard_node(self):
        # Node:358830410 Grave_yard in POIs
        self.generate_fixtures(dsl.way(358830410, wkt_loads('POINT (-122.458092404638 37.6836304096704)'), {u'amenity': u'grave_yard', u'gnis:state_id': u'06', u'name': u'Japanese Cemetery', u'gnis:county_id': u'081', u'ele': u'67', u'source': u'openstreetmap.org', u'gnis:created': u'04/06/1998', u'gnis:feature_id': u'1785699'}))  # noqa

        self.assert_has_feature(
            16, 10475, 25352, 'pois',
            {'id': 358830410, 'kind': 'grave_yard'})

    def test_grave_yard_way(self):
        # Grave_yard in POIS
        self.generate_fixtures(dsl.way(395328265, wkt_loads('POLYGON ((-122.524913227722 37.8763539649112, -122.524912688732 37.87672601508419, -122.523702927539 37.87671878256589, -122.52370705979 37.87604892065727, -122.524602680128 37.87605608233367, -122.524913227722 37.8763539649112))'), {u'amenity': u'grave_yard', u'gnis:state_id': u'06', u'name': u'Fernwood Cemetery', u'way_area': u'11962', u'gnis:county_id': u'041', u'ele': u'36', u'source': u'openstreetmap.org', u'gnis:created': u'01/19/1981', u'gnis:feature_id': u'223474'}))  # noqa

        self.assert_has_feature(
            15, 5231, 12653, 'pois',
            {'id': 395328265, 'kind': 'grave_yard'})

        self.assert_has_feature(
            15, 5231, 12653, 'landuse',
            {'id': 395328265, 'kind': 'grave_yard'})

        # Label placement Grave_yard in landuse
        self.assert_no_matching_feature(
            15, 5231, 12653, 'landuse',
            {'id': 395328265, 'kind': 'grave_yard', 'label_placement': True})

    def test_arlington_cemetery(self):
        # Arlington National Cemetery - there are two objects representing
        # this in the same place. The code will de-duplicate one or the other
        # of them.
        self.generate_fixtures(dsl.way(310423206, wkt_loads('POINT (-77.06507799187999 38.88357021310539)'), {u'bicycle': u'yes', u'barrier': u'gate', u'created_by': u'Merkaartor 0.12', u'source': u'openstreetmap.org', u'motorcycle': u'yes', u'motorcar': u'yes', u'foot': u'yes'}),dsl.way(453825952, wkt_loads('POINT (-77.07372274935371 38.87095637061771)'), {u'source': u'openstreetmap.org', u'name': u'Hobson Gate', u'barrier': u'gate'}),dsl.way(504897861, wkt_loads('POINT (-77.067701970825 38.88776626528649)'), {u'source': u'openstreetmap.org', u'barrier': u'gate'}),dsl.way(511981991, wkt_loads('POINT (-77.0702522879166 38.8693811090121)'), {u'source': u'openstreetmap.org', u'barrier': u'gate'}),dsl.way(1692602369, wkt_loads('POINT (-77.0767869027878 38.8733286041014)'), {u'source': u'openstreetmap.org', u'name': u'Memorial Chapel Gate', u'barrier': u'gate'}),dsl.way(1692602515, wkt_loads('POINT (-77.0784769033319 38.87681271126989)'), {u'source': u'openstreetmap.org', u'barrier': u'gate'}),dsl.way(2529889987, wkt_loads('POINT (-77.06204797442669 38.88097356842089)'), {u'source': u'openstreetmap.org', u'barrier': u'gate'}),dsl.way(3519900239, wkt_loads('POINT (-77.06340694578849 38.87074606265829)'), {u'source': u'openstreetmap.org', u'barrier': u'gate'}),dsl.way(3519900246, wkt_loads('POINT (-77.06365982154099 38.8709896617441)'), {u'access': u'permissive', u'source': u'openstreetmap.org', u'barrier': u'gate'}),dsl.way(171790075, wkt_loads('LINESTRING (-77.0611464252076 38.8713916019076, -77.06118478327021 38.87129767386338, -77.0613656141369 38.87116318099728, -77.06170895023848 38.8710712808894, -77.06202003682138 38.87092930408118, -77.06225413778439 38.87073060601288, -77.06254088002311 38.87058268364778, -77.06305759097449 38.87055925383598, -77.06347683471759 38.87067087758668, -77.06340694578849 38.87074606265829, -77.0633768522265 38.87077837472978, -77.0634722533097 38.87083901227879, -77.0635236369439 38.8708934951074, -77.0636087074013 38.87101120305289, -77.06365982154099 38.8709896617441, -77.06371830186599 38.8709651130369, -77.06371066618608 38.8709013982614, -77.06372459007299 38.87083180851269, -77.06378630433298 38.8707699819854, -77.0638818850792 38.8707111628071, -77.0639498875462 38.87068969134699, -77.06403549699279 38.87067395493068, -77.064410723287 38.87069745464439, -77.06454286546528 38.870687663098, -77.0647066283416 38.87066115597629, -77.0649017424213 38.87060240664758, -77.0653348202198 38.87043776838937, -77.0654807964534 38.8703935663791, -77.06559946390249 38.87036817818678, -77.0657502910387 38.8703662198685, -77.0659969684157 38.87033971262699, -77.06644648538389 38.87024760163429, -77.07000677834939 38.86939187991099, -77.07022461980578 38.86944090846278, -77.0702522879166 38.8693811090121)'), {u'source': u'openstreetmap.org', u'barrier': u'wall'}),dsl.way(171790077, wkt_loads('LINESTRING (-77.06192373742289 38.88085720563718, -77.0598544681659 38.87907670540909, -77.05916959259329 38.87800010385889)'), {u'source': u'openstreetmap.org', u'name': u'Niche Wall', u'barrier': u'wall'}),dsl.way(171790078, wkt_loads('LINESTRING (-77.07027753057601 38.86932718455189, -77.07087967131099 38.86917897950188, -77.0736955304006 38.8709393753518, -77.07372274935371 38.87095637061771, -77.07378823653789 38.87099805446259, -77.07485318930719 38.86994671888098, -77.0751886202343 38.87053330618458, -77.07547599129369 38.87103610144069, -77.07621494544638 38.87232821787848, -77.0767869027878 38.8733286041014, -77.0783869819719 38.87611148365371, -77.07847160327168 38.87677131056961, -77.0784769033319 38.87681271126989, -77.0789395357032 38.88022056357246, -77.0787532251133 38.8804191651802, -77.0783258067011 38.88090678571678, -77.0791090477973 38.88116986025689, -77.07912512764089 38.88142671013749, -77.0790286485794 38.88171691512009, -77.07882473100989 38.8820155103349, -77.0778128686738 38.88319610296649, -77.07649117739631 38.88469008429847, -77.0755391428582 38.88424996968277, -77.0743791483318 38.88561757461889, -77.07368546926941 38.88643198560599, -77.07177726794291 38.88715779434698, -77.0703794893608 38.88768997945466, -77.0679996725101 38.88787597409799, -77.0679757773236 38.88787268773078, -77.0679454142669 38.88785758442379, -77.0679320293692 38.8878385654401, -77.06790229513331 38.88781486162608, -77.06784956402609 38.8877969613955, -77.0678029414629 38.88779178710929, -77.06775542058429 38.8877964020132, -77.06775317479608 38.8877606015383, -77.067701970825 38.88776626528649, -77.0676397175758 38.8877694118131, -77.06760989350829 38.88777039073239, -77.0676132172749 38.88787366664869, -77.06694469104039 38.88791645933369, -77.06679143845298 38.88791436165368, -77.06665803863331 38.88788800080258, -77.06655473237559 38.88785066207369, -77.066462834722 38.8877938847929, -77.06636339122008 38.88770571210308, -77.0662677206423 38.88757537574588, -77.0653902462728 38.88612697590479, -77.06546822003951 38.8860906851173, -77.06548591685061 38.88605642212168, -77.0654757658878 38.88600838397559, -77.0654418095701 38.88597209312749, -77.0653852157072 38.88596139466579, -77.06533985078539 38.8859730720716, -77.06529951642911 38.8859818825681, -77.0649533057186 38.88542919660878, -77.06544944524998 38.88529501018639, -77.06561680138749 38.88521068028839, -77.06569989555121 38.8851518730614, -77.06577544386658 38.88508621309179, -77.06585224982338 38.8850048897439, -77.0659403745528 38.88487650634999, -77.0660046040956 38.88474812272408, -77.0660322722064 38.88446876866239, -77.0658346428439 38.8843668863195, -77.06558778580379 38.88397487918181, -77.06604700457699 38.88378747579029, -77.06606847431229 38.8838209007598, -77.06625092214648 38.88375412073191, -77.0662348423029 38.88372279353478, -77.0666692675743 38.88356405953398, -77.0667551465155 38.8835744786489, -77.066816770944 38.88356615734248, -77.0668597104146 38.8835328021802, -77.0668730953123 38.88349098583289, -77.0678039296097 38.88313400748549, -77.06791918346059 38.88331148293899, -77.06824958382218 38.88319225696421, -77.06831884393058 38.88316946065531, -77.06834300861171 38.88322169635839, -77.06855492118719 38.88315687373311, -77.06862193550738 38.8832779878027, -77.0687372791899 38.88323421334179, -77.068630020345 38.8830338014879, -77.0687962985041 38.8828854851637, -77.06884992792649 38.882774859585, -77.06885262287238 38.88263290615651, -77.06883384808289 38.88253060161308, -77.0687775237146 38.8824511633973, -77.06865679014049 38.8823509564366, -77.0685306666745 38.88228417502708, -77.06838325313639 38.88225711280449, -77.06820619519388 38.88225291711019, -77.06815517088579 38.88225501495738, -77.06806399188449 38.88207536908408, -77.06793535313578 38.88212760559148, -77.06804530692651 38.8823071814046, -77.06785207930889 38.8823801863951, -77.06766442124611 38.88243871620401, -77.06743642882699 38.88251801457778, -77.06753560283428 38.8827017850722, -77.06661033809171 38.88304212285669, -77.06655661883769 38.88300869752079, -77.06650029446941 38.88300869752079, -77.0664331903177 38.88302960583939, -77.06640112046199 38.88305666776776, -77.0663930356245 38.88309848437058, -77.0663930356245 38.88312771402159, -77.06507799187999 38.88357021310539, -77.0641345811687 38.88390439318809, -77.0638618526484 38.8836318886438, -77.0636036768357 38.88333099262498, -77.06209289019088 38.88136020757579, -77.0621005258708 38.88100930238649, -77.06204797442669 38.88097356842089, -77.06192373742289 38.88085720563718)'), {u'source': u'openstreetmap.org', u'barrier': u'wall'}),dsl.way(245889081, wkt_loads('LINESTRING (-77.05916959259329 38.87800010385889, -77.05892408302618 38.87611085424508, -77.05817884066649 38.87524247491529, -77.0581196416893 38.87447800978698, -77.05859799457808 38.87374717595387, -77.05938312213638 38.87247375872361, -77.060075992715 38.87165660001688, -77.0611464252076 38.8713916019076)'), {u'source': u'openstreetmap.org', u'name': u'Niche Wall', u'barrier': u'fence'}),dsl.way(499133373, wkt_loads('LINESTRING (-77.0702522879166 38.8693811090121, -77.07027753057601 38.86932718455189)'), {u'source': u'openstreetmap.org', u'barrier': u'wall'}),dsl.way(-2475077, wkt_loads('POLYGON ((-77.07912512764089 38.88142671013749, -77.0790286485794 38.88171691512009, -77.07882473100989 38.8820155103349, -77.0778128686738 38.88319610296649, -77.07649117739631 38.88469008429847, -77.0755391428582 38.88424996968277, -77.0743791483318 38.88561757461889, -77.07368546926941 38.88643198560599, -77.07177726794291 38.88715779434698, -77.0703794893608 38.88768997945466, -77.0679996725101 38.88787597409799, -77.0679757773236 38.88787268773078, -77.0679454142669 38.88785758442379, -77.0679320293692 38.8878385654401, -77.06790229513331 38.88781486162608, -77.06784956402609 38.8877969613955, -77.0678029414629 38.88779178710929, -77.06775542058429 38.8877964020132, -77.06775317479608 38.8877606015383, -77.067701970825 38.88776626528649, -77.0676397175758 38.8877694118131, -77.06760989350829 38.88777039073239, -77.0676132172749 38.88787366664869, -77.06694469104039 38.88791645933369, -77.06679143845298 38.88791436165368, -77.06665803863331 38.88788800080258, -77.06655473237559 38.88785066207369, -77.066462834722 38.8877938847929, -77.06636339122008 38.88770571210308, -77.0662677206423 38.88757537574588, -77.0653902462728 38.88612697590479, -77.06546822003951 38.8860906851173, -77.06548591685061 38.88605642212168, -77.0654757658878 38.88600838397559, -77.0654418095701 38.88597209312749, -77.0653852157072 38.88596139466579, -77.06533985078539 38.8859730720716, -77.06529951642911 38.8859818825681, -77.0649533057186 38.88542919660878, -77.06544944524998 38.88529501018639, -77.06561680138749 38.88521068028839, -77.06569989555121 38.8851518730614, -77.06577544386658 38.88508621309179, -77.06585224982338 38.8850048897439, -77.0659403745528 38.88487650634999, -77.0660046040956 38.88474812272408, -77.0660322722064 38.88446876866239, -77.0658346428439 38.8843668863195, -77.06558778580379 38.88397487918181, -77.06604700457699 38.88378747579029, -77.06606847431229 38.8838209007598, -77.06625092214648 38.88375412073191, -77.0662348423029 38.88372279353478, -77.0666692675743 38.88356405953398, -77.0667551465155 38.8835744786489, -77.066816770944 38.88356615734248, -77.0668597104146 38.8835328021802, -77.0668730953123 38.88349098583289, -77.0678039296097 38.88313400748549, -77.06791918346059 38.88331148293899, -77.06824958382218 38.88319225696421, -77.06831884393058 38.88316946065531, -77.06834300861171 38.88322169635839, -77.06855492118719 38.88315687373311, -77.06862193550738 38.8832779878027, -77.0687372791899 38.88323421334179, -77.068630020345 38.8830338014879, -77.0687962985041 38.8828854851637, -77.06884992792649 38.882774859585, -77.06885262287238 38.88263290615651, -77.06883384808289 38.88253060161308, -77.0687775237146 38.8824511633973, -77.06865679014049 38.8823509564366, -77.0685306666745 38.88228417502708, -77.06838325313639 38.88225711280449, -77.06820619519388 38.88225291711019, -77.06815517088579 38.88225501495738, -77.06806399188449 38.88207536908408, -77.06793535313578 38.88212760559148, -77.06804530692651 38.8823071814046, -77.06785207930889 38.8823801863951, -77.06766442124611 38.88243871620401, -77.06743642882699 38.88251801457778, -77.06753560283428 38.8827017850722, -77.06661033809171 38.88304212285669, -77.06655661883769 38.88300869752079, -77.06650029446941 38.88300869752079, -77.0664331903177 38.88302960583939, -77.06640112046199 38.88305666776776, -77.0663930356245 38.88309848437058, -77.0663930356245 38.88312771402159, -77.06507799187999 38.88357021310539, -77.0641345811687 38.88390439318809, -77.0638618526484 38.8836318886438, -77.0636036768357 38.88333099262498, -77.06209289019088 38.88136020757579, -77.0621005258708 38.88100930238649, -77.06204797442669 38.88097356842089, -77.06192373742289 38.88085720563718, -77.0598544681659 38.87907670540909, -77.05916959259329 38.87800010385889, -77.05892408302618 38.87611085424508, -77.05817884066649 38.87524247491529, -77.0581196416893 38.87447800978698, -77.05859799457808 38.87374717595387, -77.05938312213638 38.87247375872361, -77.060075992715 38.87165660001688, -77.0611464252076 38.8713916019076, -77.06118478327021 38.87129767386338, -77.0613656141369 38.87116318099728, -77.06170895023848 38.8710712808894, -77.06202003682138 38.87092930408118, -77.06225413778439 38.87073060601288, -77.06254088002311 38.87058268364778, -77.06305759097449 38.87055925383598, -77.06347683471759 38.87067087758668, -77.06340694578849 38.87074606265829, -77.0633768522265 38.87077837472978, -77.0634722533097 38.87083901227879, -77.0635236369439 38.8708934951074, -77.0636087074013 38.87101120305289, -77.06365982154099 38.8709896617441, -77.06371830186599 38.8709651130369, -77.06371066618608 38.8709013982614, -77.06372459007299 38.87083180851269, -77.06378630433298 38.8707699819854, -77.0638818850792 38.8707111628071, -77.0639498875462 38.87068969134699, -77.06403549699279 38.87067395493068, -77.064410723287 38.87069745464439, -77.06454286546528 38.870687663098, -77.0647066283416 38.87066115597629, -77.0649017424213 38.87060240664758, -77.0653348202198 38.87043776838937, -77.0654807964534 38.8703935663791, -77.06559946390249 38.87036817818678, -77.0657502910387 38.8703662198685, -77.0659969684157 38.87033971262699, -77.06644648538389 38.87024760163429, -77.07000677834939 38.86939187991099, -77.07022461980578 38.86944090846278, -77.0702522879166 38.8693811090121, -77.07027753057601 38.86932718455189, -77.07087967131099 38.86917897950188, -77.0736955304006 38.8709393753518, -77.07372274935371 38.87095637061771, -77.07378823653789 38.87099805446259, -77.07485318930719 38.86994671888098, -77.0751886202343 38.87053330618458, -77.07547599129369 38.87103610144069, -77.07621494544638 38.87232821787848, -77.0767869027878 38.8733286041014, -77.0783869819719 38.87611148365371, -77.07847160327168 38.87677131056961, -77.0784769033319 38.87681271126989, -77.0789395357032 38.88022056357246, -77.0787532251133 38.8804191651802, -77.0783258067011 38.88090678571678, -77.0791090477973 38.88116986025689, -77.07912512764089 38.88142671013749))'), {u'name': u'Arlington National Cemetery', u'way_area': u'4.26799e+06', u'name:de': u'Nationalfriedhof Arlington', u'source': u'openstreetmap.org', u'wikidata': u'Q216344', u'landuse': u'cemetery'}),dsl.way(41654965, wkt_loads('POLYGON ((-77.07912512764089 38.88142671013749, -77.0790286485794 38.88171691512009, -77.07882473100989 38.8820155103349, -77.0778128686738 38.88319610296649, -77.07649117739631 38.88469008429847, -77.0755391428582 38.88424996968277, -77.0743791483318 38.88561757461889, -77.07368546926941 38.88643198560599, -77.07177726794291 38.88715779434698, -77.0703794893608 38.88768997945466, -77.0679996725101 38.88787597409799, -77.0679757773236 38.88787268773078, -77.0679454142669 38.88785758442379, -77.0679320293692 38.8878385654401, -77.06790229513331 38.88781486162608, -77.06784956402609 38.8877969613955, -77.0678029414629 38.88779178710929, -77.06775542058429 38.8877964020132, -77.06775317479608 38.8877606015383, -77.067701970825 38.88776626528649, -77.0676397175758 38.8877694118131, -77.06760989350829 38.88777039073239, -77.0676132172749 38.88787366664869, -77.06694469104039 38.88791645933369, -77.06679143845298 38.88791436165368, -77.06665803863331 38.88788800080258, -77.06655473237559 38.88785066207369, -77.066462834722 38.8877938847929, -77.06636339122008 38.88770571210308, -77.0662677206423 38.88757537574588, -77.0653902462728 38.88612697590479, -77.06546822003951 38.8860906851173, -77.06548591685061 38.88605642212168, -77.0654757658878 38.88600838397559, -77.0654418095701 38.88597209312749, -77.0653852157072 38.88596139466579, -77.06533985078539 38.8859730720716, -77.06529951642911 38.8859818825681, -77.0649533057186 38.88542919660878, -77.06544944524998 38.88529501018639, -77.06561680138749 38.88521068028839, -77.06569989555121 38.8851518730614, -77.06577544386658 38.88508621309179, -77.06585224982338 38.8850048897439, -77.0659403745528 38.88487650634999, -77.0660046040956 38.88474812272408, -77.0660322722064 38.88446876866239, -77.0658346428439 38.8843668863195, -77.06558778580379 38.88397487918181, -77.0653146979574 38.88348588116008, -77.06411365042248 38.8839023653162, -77.0638618526484 38.8836318886438, -77.0636036768357 38.88333099262498, -77.06209289019088 38.88136020757579, -77.0621005258708 38.88100930238649, -77.06204797442669 38.88097356842089, -77.06192373742289 38.88085720563718, -77.0598544681659 38.87907670540909, -77.05916959259329 38.87800010385889, -77.05892408302618 38.87611085424508, -77.05817884066649 38.87524247491529, -77.0581196416893 38.87447800978698, -77.05859799457808 38.87374717595387, -77.05938312213638 38.87247375872361, -77.060075992715 38.87165660001688, -77.0611464252076 38.8713916019076, -77.06221874416218 38.87113555502597, -77.0632940275573 38.87087880782779, -77.0633896981351 38.8708739120673, -77.063476565223 38.87088957849979, -77.06355328134831 38.87093958516989, -77.0636087074013 38.87101120305289, -77.06365982154099 38.8709896617441, -77.06371830186599 38.8709651130369, -77.06371066618608 38.8709013982614, -77.06372459007299 38.87083180851269, -77.06378630433298 38.8707699819854, -77.0638818850792 38.8707111628071, -77.0639498875462 38.87068969134699, -77.06403549699279 38.87067395493068, -77.064410723287 38.87069745464439, -77.06454286546528 38.870687663098, -77.0647066283416 38.87066115597629, -77.0649017424213 38.87060240664758, -77.0653348202198 38.87043776838937, -77.0654807964534 38.8703935663791, -77.06561177082189 38.87036908740589, -77.0657502910387 38.8703662198685, -77.0659969684157 38.87033971262699, -77.06644648538389 38.87024760163429, -77.07000677834939 38.86939187991099, -77.07022461980578 38.86944090846278, -77.0702522879166 38.8693811090121, -77.07027753057601 38.86932718455189, -77.07087967131099 38.86917897950188, -77.0736955304006 38.8709393753518, -77.07372274935371 38.87095637061771, -77.07378823653789 38.87099805446259, -77.07485318930719 38.86994671888098, -77.0751886202343 38.87053330618458, -77.07547599129369 38.87103610144069, -77.07621494544638 38.87232821787848, -77.0767869027878 38.8733286041014, -77.0783869819719 38.87611148365371, -77.07847160327168 38.87677131056961, -77.0784769033319 38.87681271126989, -77.0789395357032 38.88022056357246, -77.0787532251133 38.8804191651802, -77.0783258067011 38.88090678571678, -77.0791090477973 38.88116986025689, -77.07912512764089 38.88142671013749))'), {u'name:eo': u'Arlingtona nacia tombejo', u'name': u'Arlington National Cemetery', u'wikipedia': u'en:Arlington National Cemetery', u'way_area': u'4.29348e+06', u'name:cs': u'Arlingtonsk\xfd n\xe1rodn\xed h\u0159bitov', u'name:pt': u'Cemit\xe9rio Nacional de Arlington', u'name:de': u'Nationalfriedhof Arlington', u'source': u'openstreetmap.org', u'name:fr': u"Cimeti\xe8re national d'Arlington", u'alt_name:cs': u'Arlingtonsk\xfd h\u0159bitov', u'name:it': u'Cimitero nazionale di Arlington', u'name:ru': u'\u0410\u0440\u043b\u0438\u043d\u0433\u0442\u043e\u043d\u0441\u043a\u043e\u0435 \u043d\u0430\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e\u0435 \u043a\u043b\u0430\u0434\u0431\u0438\u0449\u0435', u'wikidata': u'Q216344', u'landuse': u'cemetery', u'name:es': u'Cementerio Nacional de Arlington'}))  # noqa

        self.assert_has_feature(
            12, 1171, 1567, 'pois',
            {'id': set([41654965, -2475077]), 'kind': 'cemetery',
             'min_zoom': 12})

    def test_cemetery_label(self):
        # Label placement Cemetery in landuse
        self.generate_fixtures(dsl.way(44580948, wkt_loads('POLYGON ((-119.88781887966 34.97776097546719, -119.887378884834 34.97773698001399, -119.887378884834 34.97728496619119, -119.887808908361 34.9772929892559, -119.88781887966 34.97776097546719))'), {u'tiger:AWATER': u'0', u'Tiger:MTFCC': u'K2582', u'tiger:ALAND': u'2026', u'way_area': u'3025.11', u'tiger:reviewed': u'no', u'longitude': u'-119.8875977', u'tiger:COUNTYFP': u'083', u'source': u'openstreetmap.org', u'tiger:STATEFP': u'06', u'latitude': u'+34.9775199', u'tiger:AREAID': u'110809877813', u'landuse': u'cemetery'}))  # noqa

        self.assert_no_matching_feature(
            15, 5471, 12981, 'landuse',
            {'id': 44580948, 'kind': 'cemetery', 'label_placement': True})

    def test_farm(self):
        # Way:179213166 Farm in POIs
        self.generate_fixtures(dsl.way(179213166, wkt_loads('POLYGON ((-106.826973562823 38.83594618255059, -106.826838276542 38.8365061106343, -106.826732275338 38.8369153129762, -106.825855160295 38.8368633231374, -106.82594184772 38.83650387149059, -106.825758591402 38.83623531367319, -106.825683582075 38.83606527784548, -106.825736942003 38.8354320832413, -106.82574026577 38.83464059955788, -106.825653578345 38.83405406605439, -106.825820036167 38.83369697940329, -106.825994399164 38.83371629277769, -106.826081535746 38.83350251582329, -106.826691671487 38.83340979730468, -106.826814740681 38.83432256212711, -106.826873580332 38.83492637719451, -106.826894780573 38.83523825417249, -106.826930264027 38.83551542258118, -106.826973562823 38.83594618255059))'), {u'website': u'http://cementcreekranch.com/', u'name': u'Cement Creek Ranch', u'way_area': u'58698.4', u'access': u'private', u'source': u'openstreetmap.org', u'landuse': u'farm'}))  # noqa

        self.assert_has_feature(
            15, 6660, 12542, 'pois',
            {'id': 179213166, 'kind': 'farm'})

        # Label placement farm in landuse
        self.assert_no_matching_feature(
            15, 6660, 12542, 'landuse',
            {'id': 179213166, 'kind': 'farm', 'label_placement': True})

    def test_forest_way(self):
        # landuse: Forest in POIS
        self.generate_fixtures(dsl.way(375855355, wkt_loads('POLYGON ((-122.925877332767 45.5089216821027, -122.925871583549 45.50933780500298, -122.925655898049 45.5092836021792, -122.925394039144 45.5092535104612, -122.925095079817 45.50922587391108, -122.92477258463 45.50921259073521, -122.924453233547 45.50924475993769, -122.924187242391 45.50928479829319, -122.923901218805 45.50932779542619, -122.923654900754 45.50936481196539, -122.923413074279 45.50937135910589, -122.92298996778 45.50942209941851, -122.922743200572 45.5094516874209, -122.9227501176 45.50889788557148, -122.922981523617 45.50889788557148, -122.923488622595 45.5088976967102, -122.923771681741 45.5088975708025, -122.923843726627 45.5087860165587, -122.923847679214 45.50847080537579, -122.924018987938 45.50847067946721, -122.924253088901 45.50847061651298, -122.924487100033 45.50847061651298, -122.924541537939 45.50847061651298, -122.924534441248 45.5087138713149, -122.924629033848 45.50874786646749, -122.924789113632 45.50880528045639, -122.925022226448 45.50881289787809, -122.92585990545 45.50883770170709, -122.92585756983 45.50892149324138, -122.925877332767 45.5089216821027))'), {u'operator': u'City of Hillsboro', u'source': u'openstreetmap.org', u'landuse': u'forest', u'way_area': u'29977.9', u'name': u'Lexington Estates'}))  # noqa

        self.assert_has_feature(
            15, 5195, 11721, 'pois',
            {'id': 375855355, 'kind': 'forest'})

        # Label placement forest in landuse
        self.assert_no_matching_feature(
            15, 5195, 11721, 'landuse',
            {'id': 375855355, 'kind': 'forest', 'label_placement': True})

    def test_forest_node(self):
        # Node:357559979 landuse: Forest in POIS
        self.generate_fixtures(dsl.way(357559979, wkt_loads('POINT (-117.534299580093 41.6832263153935)'), {u'gnis:state_id': u'32', u'name': u'Santa Rosa Ranger District', u'gnis:county_id': u'013', u'ele': u'2187', u'source': u'openstreetmap.org', u'gnis:created': u'05/01/1990', u'gnis:feature_id': u'862882', u'landuse': u'forest'}))  # noqa

        self.assert_has_feature(
            16, 11371, 24405, 'pois',
            {'id': 357559979, 'kind': 'forest', 'min_zoom': 16})

    def test_forest_protect_class(self):
        # Way:432810821 landuse: Forest protect class in POIS
        self.generate_fixtures(dsl.way(432810821, wkt_loads('POLYGON ((-77.98620509432449 42.22428038762749, -77.98616529895739 42.22585161847129, -77.98269852061289 42.22722351980838, -77.97781438041319 42.22719079248588, -77.9776788246368 42.23268748090079, -77.97952073029529 42.2327415560874, -77.97965960983828 42.2377408164557, -77.9816253931745 42.23772179520839, -77.9830751842116 42.23774706819301, -77.9861408647817 42.2377208640983, -77.98612909685139 42.24434277160618, -77.9845433008804 42.2440737084351, -77.98273669901251 42.2443564707879, -77.9804991753028 42.24521738523759, -77.97866463582959 42.24657177553168, -77.97752602120698 42.24651718020707, -77.97704892595959 42.24695021758529, -77.97441713167169 42.24654617358878, -77.9736680265563 42.24438047759909, -77.97365832475121 42.2434013779963, -77.97416102198419 42.24316110624128, -77.97430349478819 42.24284967597609, -77.97572319226329 42.24201878873339, -77.97572256344259 42.24199238690239, -77.97126413485599 42.24192521846648, -77.97121939875478 42.24140968171429, -77.96306548075239 42.23848729612129, -77.96303718382089 42.23775917261889, -77.95995353694509 42.23783605562149, -77.9598929006635 42.23670780811268, -77.95685174410059 42.23588196124768, -77.95660874981618 42.2293051954269, -77.94741610985081 42.22927626063959, -77.9473548447484 42.22768476039008, -77.94324379468219 42.2276457140509, -77.94324127939939 42.22409505697429, -77.94174486579909 42.22338366426789, -77.94068988432939 42.22284416062079, -77.94013247969561 42.22252045621968, -77.93740627247139 42.2211018849321, -77.93359579869919 42.2205807894729, -77.93346078191199 42.21697125545459, -77.9319998517654 42.21696905997339, -77.9319072354596 42.2124428133734, -77.93712716591259 42.212375680024, -77.9371370473807 42.21333589969677, -77.94339794558491 42.21323776261588, -77.9434572343937 42.21053171392389, -77.9470112391522 42.21049791336448, -77.9471046639418 42.21733310963441, -77.94760457639738 42.21739897365799, -77.94821947320939 42.2174148741545, -77.94865650359509 42.21746650084328, -77.9496963035365 42.2171198161731, -77.95113082321369 42.21688995606888, -77.95149868332248 42.21690998154109, -77.9514039110601 42.22099211795809, -77.9566370467477 42.22098925736168, -77.95664647905819 42.22015608650779, -77.9570710228615 42.22013227006018, -77.95708431792769 42.21819718694049, -77.9566533960859 42.21816106198659, -77.95665968429289 42.21627322164079, -77.95762267827739 42.21618666544249, -77.96056861342018 42.2161826070782, -77.96125088387849 42.21613816464608, -77.96168072774189 42.21627095960478, -77.96219070132869 42.2161856009535, -77.96313132726269 42.21611640913268, -77.96380883664999 42.21613031403359, -77.96444286757749 42.21619498176178, -77.96539930386049 42.21613490464607, -77.9655601921279 42.2238722736421, -77.9644011857483 42.22389316169167, -77.96445346769789 42.22712999412229, -77.97640869665659 42.22715460615839, -77.97646394304658 42.2223363843579, -77.9861969196554 42.2224102925679, -77.98616368198989 42.2233182721478, -77.98620509432449 42.22428038762749))'), {u'website': u'http://www.dec.ny.gov/lands/51314.html', u'landuse': u'forest', u'name': u'Plumbottom State Forest', u'facility': u'Plumbottom State Forest', u'way_area': u'1.24357e+07', u'site_ownership': u'state', u'leisure': u'nature_reserve', u'access': u'yes', u'source': u'openstreetmap.org', u'governance': u'government_managed', u'protection_object': u'timber', u'boundary': u'protected_area', u'related_law': u'New York State Constitution, Article XIV', u'protection_title': u'State Forest', u'protect_class': u'6'}))  # noqa

        self.assert_has_feature(
            8, 72, 94, 'pois',
            {'id': 432810821, 'kind': 'forest', 'protect_class': '6'})

    def test_natural_forest_way(self):
        # Way: natural: Forest in POIS
        # note: since #1103, there should be no POIs for natural_forest,
        # only label placements in the landuse layer.
        self.generate_fixtures(dsl.way(202680509, wkt_loads('POLYGON ((-72.8282241701547 41.55614730899158, -72.82812769109321 41.55637606326199, -72.8279667129943 41.55658491930441, -72.82781651467879 41.5568056727527, -72.8276770961467 41.55695819654311, -72.8274087693713 41.5571548838084, -72.82728013062258 41.5572231125046, -72.82711385246348 41.55733550484018, -72.82694748447291 41.55735956968099, -72.82680267604908 41.55735956968099, -72.8266793373606 41.5572752754789, -72.82659336858789 41.55715091780307, -72.8265880685277 41.5569942940115, -72.82660953826299 41.55681367202608, -72.8267328769515 41.55660091790489, -72.82680267604908 41.55641229549799, -72.82690463483389 41.55614327570299, -72.8269947358569 41.5559353593372, -72.8272747407309 41.55583015730019, -72.8275161180478 41.55573389560568, -72.82773072556908 41.55566956421178, -72.82791847346348 41.55568569748268, -72.82811691130981 41.55577395984789, -72.82818132051568 41.55586228931429, -72.82820198176718 41.55594261927978, -72.82820809031109 41.5560308812941, -72.8282241701547 41.55614730899158))'), {u'natural': u'forest', u'name': u'Mine Island', u'way_area': u'29390.7', u'ele': u'134', u'source': u'openstreetmap.org', u'place': u'island'}))  # noqa

        self.assert_no_matching_feature(
            14, 4877, 6109, 'pois',
            {'id': 202680509, 'kind': 'natural_forest'})

        # Label placement forest in landuse
        self.assert_has_feature(
            15, 9755, 12218, 'landuse',
            {'id': 202680509, 'kind': 'natural_forest',
             'label_placement': True})

    def test_natural_forest_node(self):
        # natural: Forest in POIS
        # note: since #1103, there should be no POIs for natural_forest,
        # only label placements in the landuse layer.
        self.generate_fixtures(dsl.way(4633280957, wkt_loads('POINT (80.44122925992649 9.223586197936115)'), {u'source': u'openstreetmap.org', u'natural': u'forest', u'name': u'Panikkankulam Forest Reserve'}))  # noqa

        self.assert_no_matching_feature(
            14, 11852, 7770, 'pois',
            {'id': 4633280957, 'kind': 'natural_forest', 'min_zoom': 14})

    def test_golf_course_way(self):
        # Way:30903221 Golf_course in POIS
        self.generate_fixtures(dsl.way(30903221, wkt_loads('POLYGON ((-122.508102874147 37.76920898780418, -122.508068558503 37.76940568638049, -122.50783679316 37.7697109586945, -122.506720995745 37.76951426093011, -122.506377659644 37.76946000918029, -122.506120202483 37.7692836197083, -122.504575279858 37.76895789456517, -122.50444493431 37.7689627943, -122.50437791999 37.7690324557122, -122.504333183889 37.76942620833177, -122.504256557595 37.76947080272539, -122.503820335693 37.7695717791031, -122.503459482443 37.76950751496859, -122.502910162647 37.76939212342689, -122.50264408166 37.76914791882571, -122.502897676065 37.76874748970418, -122.502961725944 37.76867299928089, -122.502172016978 37.76786560065008, -122.504240477751 37.7673294603654, -122.505596664336 37.76709206614738, -122.506094510666 37.76707168557329, -122.506660988284 37.76714631963439, -122.507210308081 37.76804866858819, -122.508102874147 37.76920898780418))'), {u'source': u'openstreetmap.org', u'way_area': u'156192', u'name': u'Golden Gate Park Golf Course', u'leisure': u'golf_course'}))  # noqa

        self.assert_has_feature(
            14, 2616, 6333, 'pois',
            {'id': 30903221, 'kind': 'golf_course'})

        # Label placement Golf_course in landuse
        self.assert_no_matching_feature(
            15, 5233, 12666, 'landuse',
            {'id': 30903221, 'kind': 'golf_course', 'label_placement': True})

    def test_golf_course_node(self):
        # Node:4035914099 Golf_course in POIS
        self.generate_fixtures(dsl.way(4035914099, wkt_loads('POINT (-121.107974478937 37.7434944183373)'), {u'source': u'openstreetmap.org', u'name': u'Spring Creek Golf Course & Country Club', u'leisure': u'golf_course'}))  # noqa

        self.assert_has_feature(
            14, 2680, 6334, 'pois',
            {'id': 4035914099, 'kind': 'golf_course', 'min_zoom': 14})

    def test_military_way(self):
        # Way:330274727 Military in POIS
        self.generate_fixtures(dsl.way(330274727, wkt_loads('POLYGON ((-122.500076606746 37.49801691565801, -122.499924971126 37.498061815767, -122.499921377865 37.49814256462539, -122.499878707889 37.49818026640138, -122.499733899465 37.49818069402068, -122.499736774074 37.49823179450689, -122.499604362401 37.4983136834975, -122.499440958851 37.498713078123, -122.499337023773 37.49872547899257, -122.498654393988 37.49918787316588, -122.498626366552 37.49924025580238, -122.498153673049 37.4992634894499, -122.498081089174 37.49928565405769, -122.497762636406 37.49948185687499, -122.497692118656 37.49942256134491, -122.49706168099 37.4987375947827, -122.497146841279 37.4983937193868, -122.497181785743 37.49787580085368, -122.496755535141 37.497270001947, -122.496232535982 37.4969698802211, -122.495833414502 37.49640419987279, -122.496007058846 37.49597628411059, -122.498712604819 37.49574087237839, -122.498897478104 37.49579247343922, -122.499415716192 37.49644097599648, -122.499559536469 37.4966627726993, -122.499575706144 37.4967741697022, -122.499693475278 37.4968973975432, -122.499704075398 37.4970901143606, -122.499993692246 37.49760055494779, -122.4999909973 37.4979224115306, -122.500074360958 37.49796716915638, -122.500076606746 37.49801691565801))'), {u'way_area': u'151145', u'source': u'openstreetmap.org', u'landuse': u'military', u'name': u'Pillar Point Air Force Station'}))  # noqa

        self.assert_has_feature(
            15, 5233, 12697, 'pois',
            {'id': 330274727, 'kind': 'military'})

        # Label placement military in landuse
        self.assert_no_matching_feature(
            15, 5233, 12697, 'landuse',
            {'id': 330274727, 'kind': 'military', 'label_placement': True})

    def test_military_node(self):
        # Node:369174053 Military in POIS
        self.generate_fixtures(dsl.way(369174053, wkt_loads('POINT (-122.480679913637 37.8329513912257)'), {u'gnis:county_name': u'Marin', u'name': u'Fort Baker Military Reservation', u'gnis:feature_type': u'Military', u'addr:state': u'CA', u'ele': u'73', u'source': u'openstreetmap.org', u'gnis:created': u'11/17/2008', u'gnis:feature_id': u'2512183', u'landuse': u'military', u'source_ref': u'geonames.usgs.gov'}))  # noqa

        self.assert_has_feature(
            16, 10471, 25317, 'pois',
            {'id': 369174053, 'kind': 'military', 'min_zoom': 16})

    # see 1609-too-many-small-parks.py

    def test_national_park_node(self):
        # NOTE: this node was clearly bogus, as there was already a much larger
        # relation for Rocky Mountain National Park. however, the test still
        # has validity to make sure our rules are working OK.

        # Node:617506856 national_park in POIS
        self.generate_fixtures(dsl.way(617506856, wkt_loads('POINT (-105.857340938466 40.2967319715282)'), {u'source': u'openstreetmap.org', u'boundary': u'national_park', u'attribution': u'Natinal Park Service', u'name': u'Rocky Mountain National Park', u'leisure': u'park'}))  # noqa

        self.assert_has_feature(
            16, 13497, 24739, 'pois',
            {'id': 617506856, 'kind': 'park', 'min_zoom': 16})

    def test_nature_reserve_way(self):
        # Way:40260866 nature_reserve in POIS
        self.generate_fixtures(dsl.way(40260866, wkt_loads('POLYGON ((-116.654107986493 33.7994383155019, -116.654100260982 33.79951856324119, -116.653920597925 33.7999755633514, -116.653068186552 33.8019579839597, -116.652844416215 33.80238399274161, -116.652658195456 33.8026245781554, -116.652514644674 33.80303057850371, -116.652523178669 33.80303849097528, -116.652292670967 33.80326041311089, -116.652094412784 33.80335207805648, -116.651810814649 33.8033765618364, -116.651450141062 33.80332348875579, -116.650745682217 33.80301490285031, -116.650250710495 33.80272296194299, -116.649100058448 33.80283261718458, -116.648368380649 33.80297108565159, -116.648011839312 33.80322965905179, -116.64774486001 33.8032860166031, -116.64750797427 33.80328385187669, -116.647300912597 33.8032092061034, -116.647167512777 33.8032396615868, -116.646974464822 33.80333192372019, -116.646804234076 33.8033190100133, -116.646676583474 33.803365290341, -116.646457035219 33.80329766133758, -116.646219520657 33.80322465778379, -116.645915171439 33.80337835333219, -116.645500239609 33.80342657441388, -116.64378050483 33.80359736341331, -116.64283188389 33.80376277760879, -116.642441116741 33.80383100340678, -116.641201082323 33.80404717581659, -116.640934372515 33.8042356544231, -116.640585017701 33.80452527618552, -116.640140082141 33.804666279828, -116.639784169625 33.80473316130509, -116.639643583283 33.80472039709858, -116.639546744896 33.80485617531389, -116.639397894053 33.80502270673949, -116.639182478048 33.8051581112545, -116.638901035869 33.80518819282388, -116.63880410765 33.80533628654959, -116.638492392247 33.80545900111601, -116.638284072932 33.8054448934285, -116.638144564569 33.80538995553309, -116.637973794833 33.8055131925291, -116.637598388876 33.8055783565382, -116.637373630392 33.80556701068908, -116.637165760235 33.80563426468058, -116.636943606865 33.80564605838288, -116.63681811222 33.80554685687449, -116.63674463003 33.80542921821729, -116.636760620042 33.80513855449659, -116.636926898201 33.804341351551, -116.636705463483 33.8041801185917, -116.63658769435 33.8040127644302, -116.636596228345 33.8037469527989, -116.636659739235 33.80363035670349, -116.63676053021 33.80343209818928, -116.636805984964 33.80317248035909, -116.637037301149 33.80276506240639, -116.637327995975 33.80235786645359, -116.637521223593 33.80218528345971, -116.637619319622 33.80177748757199, -116.637738615892 33.80157377551749, -116.637835544111 33.80143187101119, -116.637865996999 33.80124032568119, -116.637959331957 33.80107886293631, -116.638177981897 33.8010001096146, -116.6383785757 33.80083999007828, -116.63862363611 33.80072309143039, -116.638646363486 33.80056856998409, -116.638520689178 33.80051877968089, -116.638543416555 33.80040755386139, -116.63862543274 33.80027796440219, -116.63845556132 33.80014135778971, -116.638523294292 33.7999189796739, -116.638672594293 33.79963509028969, -116.638747513787 33.79942510261109, -116.638851808192 33.79930790343379, -116.63881524676 33.79919025620019, -116.638570905002 33.79915867953579, -116.638282545796 33.79905887331168, -116.638065243329 33.79890046708349, -116.637951516614 33.79851378146881, -116.63732826547 33.7979298679499, -116.637184624856 33.79773861338458, -116.637200794531 33.7976067057129, -116.637008375397 33.79739111424198, -116.636801942545 33.7971749250196, -116.636684981895 33.79679726442898, -116.636478459211 33.79659876613091, -116.636333291461 33.79632636211358, -116.63631676246 33.7962954562591, -116.636332932135 33.79599871469707, -116.636496425517 33.79586926786708, -116.636541431112 33.7957334007415, -116.636697109151 33.79570301723938, -116.636886474013 33.79574989890399, -116.637125964868 33.79584649894077, -116.637598568539 33.79615697699148, -116.637717235988 33.79613876191218, -116.637859079971 33.7958547853376, -116.638134413606 33.79554020030371, -116.63852904351 33.79507145600709, -116.638840669082 33.79490550244221, -116.639174303379 33.7948445855333, -116.639757669324 33.7948436896961, -116.64053677817 33.79486720541996, -116.640981534067 33.79495499739879, -116.641424223839 33.7951726852842, -116.641719859399 33.7953219907841, -116.641904014033 33.79553885655879, -116.642258219749 33.79588001778428, -116.642490344419 33.7962234918591, -116.642715013071 33.7964069113775, -116.642870421615 33.79646297481489, -116.64339144448 33.7964950750355, -116.643706932808 33.79655188493118, -116.643970498512 33.79668506330391, -116.64485138648 33.79736528503349, -116.645848426614 33.79804826341897, -116.646343218672 33.7983897132431, -116.646668498637 33.79868331122649, -116.647287437867 33.79929521306741, -116.647973930407 33.79985358740909, -116.648188897255 33.799804767124, -116.648610835944 33.79985545362738, -116.648863172707 33.7997016024545, -116.649004208207 33.7996463622764, -116.649189440818 33.79963456774728, -116.649515619098 33.79955506660659, -116.649915459231 33.79956857807328, -116.650177138473 33.7994734005693, -116.650441782156 33.7994525734778, -116.65062773342 33.79928618051139, -116.65084287993 33.799181671529, -116.651102403216 33.7991206083645, -116.651857976201 33.79905469294368, -116.652756381317 33.79902341482709, -116.653628106469 33.7990658903574, -116.65390909949 33.7991718178184, -116.654005219225 33.7992152637158, -116.654076096301 33.79932298257259, -116.654107986493 33.7994383155019))'), {u'admin_level': u'4', u'csp:globalid': u'{C501289B-64A9-46BE-BFA7-5CC3F869A3F4}', u'attribution': u'CASIL CSP_Opbdys072008', u'name': u'Hidden Divide Natural Preserve', u'way_area': u'1.48785e+06', u'leisure': u'nature_reserve', u'source': u'openstreetmap.org', u'park:type': u'state_natural_preserve', u'csp:unitcode': u'960'}))  # noqa

        self.assert_has_feature(
            13, 1441, 3277, 'pois',
            {'id': 40260866, 'kind': 'nature_reserve'})

        # Label placement nature_reserve in landuse
        self.assert_no_matching_feature(
            15, 5766, 13111, 'landuse',
            {'id': 40260866, 'kind': 'nature_reserve',
             'label_placement': True})

    def test_nature_reserve_node(self):
        import dsl

        z, x, y = (16, 15827, 24891)

        self.generate_fixtures(
            # https://www.openstreetmap.org/node/1262562806
            dsl.point(1262562806, (-93.0560463, 39.6588853), {
                'leisure': u'nature_reserve',
                'name': u'Nannie B. Floyd Memorial Conservation Area',
                'source': u'openstreetmap.org',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 1262562806,
                'kind': 'nature_reserve',
                'min_zoom': 16,
            })

    def test_park_way(self):
        # Way:23871270 park in POIS
        import dsl

        z, x, y = (14, 2620, 6333)

        self.generate_fixtures(
            # https://www.openstreetmap.org/way/23871270
            dsl.way(23871270, dsl.box_area(z, x, y, 103831), {
                'addr:postcode': '94114',
                'alt_name': 'Dolores Park',
                'leisure': 'park',
                'name': 'Mission Dolores Park',
                'source': 'openstreetmap.org',
                'wikidata': 'Q11519',
                'wikipedia': 'en:Mission Dolores Park',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 23871270,
                'kind': 'park',
                'min_zoom': 14,
            })

        # Label placement park in landuse
        self.assert_no_matching_feature(
            z, x, y, 'landuse',
            {'id': 23871270, 'kind': 'park', 'label_placement': True})

    def test_park_node(self):
        # park in POIS
        import dsl

        z, x, y = (16, 10491, 22900)

        self.generate_fixtures(
            # https://www.openstreetmap.org/node/356541963
            dsl.point(356541963, (-122.370683, 47.559821), {
                'ele': '42',
                'gnis:county_id': '033',
                'gnis:created': '12/31/1992',
                'gnis:feature_id': '1511570',
                'gnis:state_id': '53',
                'leisure': 'park',
                'name': 'West Seattle Recreation Center',
                'source': 'openstreetmap.org',
            }),
        )

        self.assert_has_feature(
            z, x, y, 'pois', {
                'id': 356541963,
                'kind': 'park',
                'min_zoom': 16,
            })

    def test_planet_way(self):
        # Way:26278098 plant in POIS
        self.generate_fixtures(dsl.way(26278098, wkt_loads('POLYGON ((-122.485376844932 37.7502587104571, -122.485104924895 37.75120700728039, -122.484880795232 37.75138507349589, -122.4830757205 37.75171776566758, -122.48221702092 37.75175661753797, -122.481988130185 37.7515941782293, -122.481892369776 37.75028051623549, -122.48204247826 37.75014840295199, -122.48512226238 37.75000961272159, -122.485376844932 37.7502587104571))'), {u'name': u'Sunset Reservoir', u'power': u'plant', u'way_area': u'77508.6', u'man_made': u'reservoir_covered', u'gnis:county_id': u'075', u'ele': u'116', u'source': u'openstreetmap.org', u'operator': u'San Francisco Public Utilities Commission', u'plant:output:electricity': u'5 MW', u'gnis:feature_id': u'235813', u'landuse': u'reservoir', u'start_date': u'2010-11'}))  # noqa

        self.assert_has_feature(
            14, 2617, 6334, 'pois',
            {'id': 26278098, 'kind': 'plant'})

        # Label placement plant in landuse
        self.assert_no_matching_feature(
            15, 5235, 12668, 'landuse',
            {'id': 26278098, 'kind': 'plant', 'label_placement': True})

    def test_plant_node(self):
        # Node:902365126 plant in POIS
        self.generate_fixtures(dsl.way(902365126, wkt_loads('POINT (-118.964311601039 37.03877355721909)'), {u'layer': u'-1', u'name': u'Helms Pumped Storage Plant', u'power': u'plant', u'wikipedia': u'en:Helms Pumped Storage Plant', u'generator:source': u'hydro', u'generator:method': u'water-pumped-storage', u'source': u'openstreetmap.org', u'location': u'underground', u'operator': u'Pacific Gas and Electric Company', u'plant:output:electricity': u'1212 MW'}))  # noqa

        self.assert_has_feature(
            14, 2777, 6374, 'pois',
            {'id': 902365126, 'kind': 'plant', 'min_zoom': 14})

    def test_pitch_node_named(self):
        # Node:2442093493 pitch in POIS
        self.generate_fixtures(dsl.way(2442093493, wkt_loads('POINT (-120.068494697136 38.93153745806469)'), {u'source': u'openstreetmap.org', u'sport': u'volleyball', u'leisure': u'pitch', u'name': u'Volleyball pitch'}))  # noqa

        self.assert_has_feature(
            16, 10910, 25062, 'pois',
            {'id': 2442093493, 'kind': 'pitch', 'min_zoom': 16})

    def test_pitch_node_unnamed_sport_in_whitelist(self):
        # Node:2442093493 pitch in POIS
        self.generate_fixtures(dsl.way(2442093493, wkt_loads('POINT (-120.068494697136 38.93153745806469)'), {u'source': u'openstreetmap.org', u'sport': u'basketball', u'leisure': u'pitch'}))  # noqa

        self.assert_has_feature(
            16, 10910, 25062, 'pois',
            {'id': 2442093493, 'kind': 'pitch', 'min_zoom': 17})

    def test_protected_area_way(self):
        # Way:296573403 protected_area in POIS
        self.generate_fixtures(dsl.way(296573403, wkt_loads('POLYGON ((-122.337881380454 37.46030647731539, -122.312205194014 37.4782012886921, -122.306261490936 37.4712460869934, -122.305471692139 37.4703218054014, -122.306930915486 37.46908109410918, -122.305986696291 37.46778681678578, -122.309186136007 37.4640296993149, -122.312383329935 37.4668670556049, -122.335422422026 37.4510334112997, -122.336070376841 37.45204857134729, -122.336838616072 37.45326317958191, -122.336838616072 37.45401267259149, -122.3364523405 37.45493252058789, -122.335937336347 37.4561589194452, -122.335679879187 37.45769021398629, -122.336066064927 37.458678115507, -122.336838616072 37.45956382151758, -122.337881380454 37.46030647731539))'), {u'website': u'http://www.filoli.org/', u'natural': u'wood', u'name': u'Filioli Center', u'way_area': u'5.03752e+06', u'source': u'openstreetmap.org', u'historic': u'estate', u'operator': u'National Trust for Historic Preservation', u'boundary': u'protected_area', u'protect_class': u'22'}))  # noqa

        self.assert_has_feature(
            9, 82, 198, 'pois',
            {'id': 296573403, 'kind': 'protected_area'})

        # Label placement protected_area in landuse
        self.assert_no_matching_feature(
            15, 5249, 12701, 'landuse',
            {'id': 296573403, 'kind': 'protected_area',
             'label_placement': True})

    def test_protected_area_node(self):
        # boundary = protected_area in POIS
        self.generate_fixtures(dsl.way(1462300228, wkt_loads('POINT (11.0625186229689 49.62113429765858)'), {u'source': u'openstreetmap.org', u'boundary': u'protected_area', u'name': u'Tongrube Marloffstein'}))  # noqa

        self.assert_has_feature(
            16, 34781, 22333, 'pois',
            {'id': 1462300228, 'kind': 'protected_area', 'min_zoom': 16})

    def test_quarry_way(self):
        # quarry in POIS
        self.generate_fixtures(dsl.way(362159618, wkt_loads('POLYGON ((-121.950923807319 47.19841420635209, -121.950259413334 47.19923740699769, -121.950363617907 47.20119339573959, -121.95022033662 47.20152090251779, -121.949803518328 47.20178639758358, -121.949334507918 47.20183949643739, -121.9452310037 47.20096329752068, -121.944866287695 47.20117569591198, -121.94513991453 47.20280417739327, -121.945491604964 47.20385739659169, -121.945178901414 47.20461856743319, -121.943563640701 47.20540621395919, -121.941922239014 47.20377781235158, -121.940059402609 47.1961747698475, -121.941127589314 47.19555521377131, -121.942365108449 47.1954046880206, -121.943667845274 47.19569676618629, -121.945608835108 47.19636948597748, -121.947276287939 47.1967058731945, -121.947901605208 47.1970775996474, -121.948670113934 47.19837880483669, -121.948722306052 47.19724576075879, -121.950923807319 47.19841420635209))'), {u'way_area': u'1.09671e+06', u'source': u'openstreetmap.org', u'landuse': u'quarry', u'name': u'Corliss Resources'}))  # noqa

        self.assert_has_feature(
            13, 1321, 2874, 'pois',
            {'id': 362159618, 'kind': 'quarry', 'min_zoom': 13})

        # Label placement quarry in landuse
        self.assert_no_matching_feature(
            15, 5284, 11498, 'landuse',
            {'id': 362159618, 'kind': 'quarry', 'label_placement': True})

    def test_quarry_node(self):
        # Node:585365655 quarry in POIS
        self.generate_fixtures(dsl.way(585365655, wkt_loads('POINT (-122.377643060717 37.74618397134519)'), {u'note': u'Record <a href="http://tin.er.usgs.gov/mineplant/show.php?labno=4035">4035</a> of the <a href="http://tin.er.usgs.gov/mineplant/">Active mines and mineral plants in the US</a>', u'source': u'openstreetmap.org', u'landuse': u'quarry', u'man_made': u'mine', u'name': u'Tidewater San Francisco'}))  # noqa

        self.assert_has_feature(
            16, 10489, 25337, 'pois',
            {'id': 585365655, 'kind': 'quarry', 'min_zoom': 16})

    def test_recreation_ground_way(self):
        # landuse=recreation_ground in POIS
        self.generate_fixtures(dsl.way(413471062, wkt_loads('POLYGON ((-122.213665487069 37.79535196006788, -122.213391860234 37.79600062088008, -122.213145093025 37.7959221117873, -122.212948631472 37.79641488628459, -122.212080319919 37.79601751523089, -122.212117779666 37.79592431231449, -122.212018605659 37.79537957334389, -122.212536304757 37.79484540723939, -122.213665487069 37.79535196006788))'), {u'way_area': u'24566.1', u'source': u'openstreetmap.org', u'landuse': u'recreation_ground', u'name': u'Curt Flood Field'}))  # noqa

        self.assert_has_feature(
            14, 2629, 6331, 'pois',
            {'id': 413471062, 'kind': 'recreation_ground', 'min_zoom': 14})

        # Label placement recreation_ground in landuse
        self.assert_no_matching_feature(
            16, 10519, 25326, 'landuse',
            {'id': 413471062, 'kind': 'recreation_ground',
             'label_placement': True})

    def test_recreation_ground_node(self):
        # recreation_ground in POIS
        self.generate_fixtures(dsl.way(417274812, wkt_loads('POINT (-122.421056482442 37.80768519393391)'), {u'source': u'openstreetmap.org', u'landuse': u'recreation_ground', u'name': u'South End Rowing Club (est. 1873)'}))  # noqa

        self.assert_has_feature(
            14, 2620, 6330, 'pois',
            {'id': 417274812, 'kind': 'recreation_ground', 'min_zoom': 14})

    def test_substation(self):
        # Node:4214350591 substation in POIS
        self.generate_fixtures(dsl.way(4214350591, wkt_loads('POINT (-122.504766082024 37.7527564602091)'), {u'source': u'openstreetmap.org', u'name': u'Noriega Substation', u'power': u'substation'}))  # noqa

        self.assert_has_feature(
            16, 10466, 25336, 'pois',
            {'id': 4214350591, 'kind': 'substation', 'min_zoom': 17})

    def test_village_green_way(self):
        # village_green in POIS
        # note: since #1103, there should be no POIs for village_green,
        # only label placements in the landuse layer.
        self.generate_fixtures(dsl.way(128479579, wkt_loads('POLYGON ((-48.1533512397624 -22.5693825201634, -48.15331539698259 -22.56922350143151, -48.1532355367538 -22.56907891616549, -48.15310977261401 -22.56895316087111, -48.1529512199664 -22.56886440211801, -48.15277227556179 -22.5688198568157, -48.1525870429502 -22.56882259423689, -48.1524097155131 -22.56887286323521, -48.152254486632 -22.5689664332031, -48.15213348356329 -22.56909600427721, -48.15205604878579 -22.56925153917641, -48.1520282908435 -22.56942084389921, -48.15205254535619 -22.5695905631726, -48.15212665636709 -22.56974734178781, -48.1522377779677 -22.56987309635781, -48.1523808795925 -22.5699673292584, -48.1525459001102 -22.5700234873913, -48.1527209817591 -22.57003775503741, -48.1528939972828 -22.5700088049866, -48.15305272959349 -22.56993895985321, -48.1531857700871 -22.56983294781361, -48.15328413561069 -22.56969831738292, -48.1533406396421 -22.56954452497391, -48.1533512397624 -22.5693825201634))'), {u'way_area': u'16867.1', u'source': u'openstreetmap.org', u'landuse': u'village_green', u'name': u'Pra\xe7a Santo Zani'}))  # noqa

        self.assert_no_matching_feature(
            14, 6000, 9246, 'pois',
            {'id': 128479579, 'kind': 'village_green', 'min_zoom': 13.23})

        # Label placement village_green in landuse
        self.assert_has_feature(
            16, 24002, 36987, 'landuse',
            {'id': 128479579, 'kind': 'village_green',
             'label_placement': True})

    def test_village_green_node(self):
        # Node:3199567035 village_green in POIS
        self.generate_fixtures(dsl.way(3199567035, wkt_loads('POINT (-88.01500447208321 43.0208257115386)'), {u'source': u'openstreetmap.org', u'landuse': u'village_green', u'name': u'Mattress Firm Rest Area'}))  # noqa

        self.assert_no_matching_feature(
            14, 4186, 6018, 'pois',
            {'id': 3199567035, 'kind': 'village_green', 'min_zoom': 14})

    def test_wastewater_plant_way(self):
        # Way:239634932 wastewater_plant in POIS
        self.generate_fixtures(dsl.way(239634932, wkt_loads('POLYGON ((-122.393207810319 37.74106796172399, -122.390467589376 37.74405296519711, -122.388585169698 37.74295966419569, -122.391254693228 37.7399788079016, -122.393207810319 37.74106796172399))'), {u'source': u'openstreetmap.org', u'way_area': u'135900', u'man_made': u'wastewater_plant', u'name': u'Southeast Water Pollution Control', u'area': u'yes'}))  # noqa

        self.assert_has_feature(
            13, 1310, 3167, 'pois',
            {'id': 239634932, 'kind': 'wastewater_plant', 'min_zoom': 13})

        # Label placement wastewater_plant in landuse
        self.assert_no_matching_feature(
            15, 5243, 12669, 'landuse',
            {'id': 239634932, 'kind': 'wastewater_plant',
             'label_placement': True})

    def test_wastewater_plant_node(self):
        # Node:2838226695 wastewater_plant in POIS
        self.generate_fixtures(dsl.way(2838226695, wkt_loads('POINT (-122.527276515571 37.89596901840991)'), {u'source': u'openstreetmap.org', u'man_made': u'wastewater_plant', u'name': u'Sewerage Agency Of Southern Marin'}))  # noqa

        self.assert_has_feature(
            14, 2615, 6325, 'pois',
            {'id': 2838226695, 'kind': 'wastewater_plant', 'min_zoom': 14})

    def test_water_works_way(self):
        # Way:93703732 water_works in POIS
        self.generate_fixtures(dsl.way(93703732, wkt_loads('POLYGON ((-122.427140322703 37.8079250837942, -122.426903077637 37.80800279942497, -122.426784589851 37.8077771044902, -122.427021834917 37.80769938862188, -122.427140322703 37.8079250837942))'), {u'building': u'yes', u'name': u'Salt Water Pumping Station #2', u'emergency': u'pumping_station', u'way_area': u'984.269', u'man_made': u'water_works', u'addr:state': u'CA', u'height': u'9.23', u'source': u'openstreetmap.org', u'operator': u'San Francisco Fire Department', u'gnis:feature_id': u'1657191', u'ele': u'1', u'gnis:county_name': u'San Francisco'}))  # noqa

        self.assert_has_feature(
            14, 2620, 6330, 'pois',
            {'id': 93703732, 'kind': 'water_works', 'min_zoom': 14})

        # Label placement water_works in landuse
        self.assert_no_matching_feature(
            15, 5240, 12661, 'landuse',
            {'id': 93703732, 'kind': 'water_works', 'label_placement': True})

    def test_water_works_node(self):
        # water_works in POIS
        self.generate_fixtures(dsl.way(1380919388, wkt_loads('POINT (-0.4025984100414879 52.53296237867349)'), {u'source': u'openstreetmap.org', u'man_made': u'water_works', u'name': u'Elton River Lane terminal Pumping Station'}))  # noqa

        self.assert_has_feature(
            14, 8173, 5372, 'pois',
            {'id': 1380919388, 'kind': 'water_works', 'min_zoom': 14})

    def test_winter_sports_way(self):
        # Way:317721523 winter_sports in POIS
        self.generate_fixtures(dsl.way(317721523, wkt_loads('POLYGON ((-119.943792366025 38.9318315811565, -119.943406090453 38.93208195867911, -119.943148633292 38.93258278095151, -119.941582240931 38.93413511885359, -119.942264870716 38.93522659155598, -119.942130842075 38.93529968189359, -119.94225687571 38.9354414601634, -119.942742415121 38.9360757904203, -119.942739720175 38.93611855405371, -119.94269004334 38.9361504870115, -119.938846421733 38.93782376785669, -119.938751200313 38.93785695776939, -119.938692180999 38.93785905397387, -119.93861169195 38.9378174093664, -119.93753964249 38.93630085820809, -119.937377227086 38.93621351438268, -119.937251283283 38.93615272301678, -119.937196036893 38.93612596082418, -119.936677529311 38.93581005438838, -119.936152823354 38.93555745400288, -119.93555310807 38.9353437037623, -119.934459768538 38.9350131896996, -119.933534234301 38.93479049362628, -119.931754581891 38.93350077123829, -119.929458577857 38.9320318552936, -119.928578857699 38.93244917278829, -119.927505999755 38.93211536091647, -119.92529578483 38.93104711044089, -119.923407615934 38.9301457200956, -119.922098680734 38.9298118973828, -119.918815607865 38.93047961111808, -119.916197827296 38.93128078942348, -119.914137900518 38.9320318552936, -119.911799046844 38.9332003660422, -119.911133844376 38.9339013793977, -119.911176694015 38.93436871778529, -119.912099443475 38.93490285495809, -119.912271021694 38.93575408409009, -119.911477090646 38.93622141026889, -119.91106943517 38.93677216363341, -119.910597280657 38.93727302265959, -119.910318443593 38.93785709751631, -119.910039426865 38.93832447970939, -119.909460103339 38.9387917889493, -119.9087519614 38.93895871430539, -119.908194107609 38.93887521674029, -119.907893710978 38.93867489205539, -119.907893710978 38.9384413073081, -119.907807832036 38.93804065492078, -119.907443116031 38.9382075820451, -119.906584775777 38.93857476443707, -119.90596251278 38.9391422688583, -119.905919573309 38.9396596707408, -119.906434577462 38.93999351697389, -119.907593314347 38.94022709660789, -119.907657633721 38.9418960890882, -119.907078310194 38.94331470530078, -119.906606245512 38.94404901528998, -119.905447508627 38.9449334609636, -119.904310241478 38.9458680591144, -119.902872577697 38.94785396067778, -119.902314723906 38.94997331214239, -119.902314723906 38.9521259930512, -119.902185905494 38.95359442288199, -119.90132756524 38.9553465090758, -119.899439396344 38.95656458198948, -119.897036133465 38.9577660087491, -119.895812987374 38.9580830048665, -119.8950833757 38.95833328969279, -119.894246595013 38.95885048166019, -119.893495603435 38.95975150710918, -119.892572943807 38.9614199700634, -119.892229607705 38.96317186277449, -119.892036469919 38.9642396990966, -119.892250987609 38.9651405861659, -119.892229607705 38.96562448170126, -119.89229392708 38.9662250858957, -119.89184081685 38.96661091151149, -119.891671664082 38.96690907979579, -119.891907741339 38.9672928063521, -119.891006461615 38.9678266954673, -119.890448607823 38.9676432151904, -119.889483008724 38.96717609614698, -119.889332810409 38.96674229010197, -119.889203991997 38.9661750066383, -119.889311340673 38.9658746700424, -119.889933603671 38.96559109525059, -119.890234000302 38.96512396267509, -119.89089920277 38.9636056906835, -119.891242538871 38.9624877629413, -119.891113810291 38.9616036061589, -119.891221069136 38.9606692154917, -119.891735983457 38.95985160481811, -119.892401185925 38.95918416766697, -119.892358336286 38.95836660971048, -119.891800392663 38.9575489724671, -119.891264008606 38.95728205953967, -119.889470342479 38.95780407909378, -119.889400094223 38.9591308702168, -119.887620531646 38.9606618811363, -119.88701542647 38.96071929864108, -119.886672000537 38.96045225795317, -119.886951017264 38.95978489631188, -119.887594660165 38.95868367299398, -119.887895146628 38.95804961486188, -119.888023875208 38.95738216073708, -119.887830737422 38.95636430728829, -119.88862466847 38.95521301366169, -119.889225461732 38.95426191268249, -119.889096822984 38.95299371161568, -119.888860745727 38.9516920948552, -119.888066814679 38.95085768390329, -119.885792280379 38.95010681742608, -119.882530677246 38.94927238781168, -119.880985844452 38.9486717097764, -119.880256232778 38.94696948157569, -119.880342021888 38.94611838707938, -119.881221831877 38.94520049026399, -119.882058612564 38.94459970785727, -119.882530677246 38.94384870522239, -119.882874013347 38.94304759902919, -119.882959892289 38.941962814433, -119.884140009077 38.94032729176409, -119.884590604024 38.93997681771238, -119.885448944278 38.93989332134609, -119.886736409743 38.93992671990438, -119.888324271839 38.939960118447, -119.889590267569 38.9397931954484, -119.890448607823 38.93929249396669, -119.891714603553 38.93862486320029, -119.892057939655 38.93767346976308, -119.892444125395 38.93687236367141, -119.892444125395 38.93640497190737, -119.890234000302 38.93642167200998, -119.888925065101 38.93587091592349, -119.888088194583 38.93473598993108, -119.88722994416 38.93311686169681, -119.887380142476 38.93271631898448, -119.887187004689 38.93221556753409, -119.886693470272 38.93164800768059, -119.886393073641 38.9311807212453, -119.886414543377 38.93024585961498, -119.886457482847 38.9295448101288, -119.887702008842 38.9287937179232, -119.888195543259 38.92847652093838, -119.888302802104 38.92797566967189, -119.88875339705 38.92764190662998, -119.888796336521 38.92695746385529, -119.889010944042 38.9262229768729, -119.889311340673 38.92588906581409, -119.890598806139 38.92528818967369, -119.89128538851 38.92522137875329, -119.892873340438 38.9252046760134, -119.894203745374 38.92522137875329, -119.894804538636 38.92473727724449, -119.895834546941 38.9240361034304, -119.897486728411 38.92305117768679, -119.897744185572 38.92248361439469, -119.897572517521 38.92159881882498, -119.897894383887 38.92111469259788, -119.89879557378 38.92006291052098, -119.899460776248 38.919996164571, -119.899825582085 38.92004627645759, -119.899868521555 38.91956206974588, -119.900297736598 38.91866060335608, -119.900791181184 38.91804289167699, -119.900662362772 38.91744187919207, -119.902915517168 38.91421957148438, -119.903795327157 38.91400261158058, -119.904717896954 38.9139692008148, -119.906284289315 38.91365186765279, -119.907443116031 38.91336808393178, -119.908601763085 38.913084299076, -119.909481483242 38.91303418227301, -119.910339823496 38.91338478945808, -119.910704629333 38.91376880578709, -119.911369831801 38.91430309807468, -119.911906305689 38.91503770845448, -119.9123354309 38.91557199118939, -119.912893284691 38.91622306420259, -119.913687215739 38.91682408700998, -119.914524086258 38.91725819858469, -119.915275077836 38.91747521842948, -119.916004689509 38.9173417215987, -119.916498223927 38.91744187919207, -119.916948818873 38.9176087849025, -119.917592461774 38.91789262155969, -119.91857962044 38.91824320474318, -119.919180413702 38.91871071618591, -119.92018886244 38.91946191514499, -119.920875624475 38.91976237852361, -119.921669465691 38.91986260259158, -119.922098680734 38.91941187273728, -119.922849672311 38.91882750620009, -119.923708012565 38.9182933178678, -119.92495253856 38.91802618724719, -119.926690598972 38.91859378619469, -119.928063943378 38.91941187273728, -119.928857784595 38.92029669557818, -119.929136801322 38.9215654116356, -119.928793375389 38.92271732158768, -119.929630335739 38.9229176913462, -119.930252598736 38.92306788093371, -119.930746133153 38.9226338747895, -119.930831922263 38.92230001672669, -119.931582913841 38.92204960467639, -119.932612922145 38.92189927315498, -119.933342533819 38.92196608720379, -119.934179314506 38.92218309265029, -119.934865986709 38.92218309265029, -119.935402370766 38.92219979610159, -119.936003164028 38.92235005709749, -119.936646986592 38.9226171714404, -119.937140521009 38.9231012874158, -119.937633965594 38.92353529070078, -119.937870042851 38.92365221254888, -119.937977301696 38.92385250977988, -119.937848573116 38.9240361034304, -119.937462297544 38.92431991437778, -119.937011702597 38.924687168671, -119.936754245437 38.92500438259989, -119.936615365894 38.92515715355188, -119.937033172332 38.92547177960891, -119.937483767279 38.92600598378308, -119.938148969747 38.92677380788037, -119.93883564195 38.92755839574049, -119.939500844418 38.92820935877318, -119.940037318306 38.92874361221491, -119.940616641832 38.92931105554499, -119.940680961207 38.92977849406069, -119.940874098993 38.93036270052237, -119.941324693939 38.93072999341319, -119.941560771196 38.93084676364278, -119.942290293038 38.93101370770039, -119.942719508081 38.93121398414699, -119.943234512233 38.93143096130588, -119.943706487083 38.9315812726297, -119.943792366025 38.9318315811565))'), {u'way_area': u'1.8992e+07', u'source': u'openstreetmap.org', u'landuse': u'winter_sports', u'name': u'Heavenly Mountain Resort'}))  # noqa

        self.assert_has_feature(
            10, 170, 391, 'pois',
            {'id': 317721523, 'kind': 'winter_sports', 'min_zoom': 10})

        # Label placement winter_sports in landuse
        self.assert_no_matching_feature(
            15, 5470, 12530, 'landuse',
            {'id': 317721523, 'kind': 'winter_sports',
             'label_placement': True})

    def test_winter_sports_node(self):
        # Node:4042754024 winter_sports in POIS
        self.generate_fixtures(dsl.way(4042754024, wkt_loads('POINT (6.25416991255289 45.25579931258878)'), {u'source': u'openstreetmap.org', u'landuse': u'winter_sports', u'name': u'Les Sybelles'}))  # noqa

        self.assert_has_feature(
            13, 4238, 2938, 'pois',
            {'id': 4042754024, 'kind': 'winter_sports', 'min_zoom': 13})

    def test_wood_way(self):
        # landuse: wood in POIS
        self.generate_fixtures(dsl.way(433247531, wkt_loads('POLYGON ((-1.72388733215078 51.77740627297298, -1.72255701704653 51.77782451358231, -1.71885550891832 51.77827587560999, -1.71869668677608 51.77668577843119, -1.72165573732197 51.77702126586529, -1.72293251283529 51.7767092893118, -1.72335094809463 51.77667610728528, -1.72353330609731 51.77672257323179, -1.72385526229514 51.77692839012048, -1.72388733215078 51.77740627297298))'), {u'way_area': u'112601', u'source': u'openstreetmap.org', u'landuse': u'wood', u'name': u"No Man's Land Plantation"}))  # noqa

        self.assert_has_feature(
            16, 32454, 21713, 'pois',
            {'id': 433247531, 'kind': 'wood', 'min_zoom': 17})

        # Label placement landuse: wood in landuse
        self.assert_no_matching_feature(
            15, 16227, 10856, 'landuse',
            {'id': 433247531, 'kind': 'wood', 'label_placement': True})

    def test_natural_wood_way(self):
        # natural: wood in POIS
        # note: since #1103, there should be no POIs for natural_wood, only
        # label placements in the landuse layer.
        self.generate_fixtures(dsl.way(249171216, wkt_loads('POLYGON ((-1.86315881003412 51.80373247416248, -1.86299792176674 51.80384529195328, -1.86219321093522 51.80410408856621, -1.86177477567588 51.8042099064572, -1.86128133109031 51.80452197058098, -1.8608307361438 51.8048470859973, -1.86054102946467 51.80510576576659, -1.86029426225612 51.8053906617378, -1.86012259420533 51.80566939034878, -1.8598651370449 51.8057555970154, -1.859414542098379 51.8060807035348, -1.85925410298864 51.80602760240799, -1.8593077324111 51.80570249550569, -1.85938229257968 51.80541726822999, -1.85959690010106 51.80503277789531, -1.8598328875262 51.80467461347749, -1.86053033951279 51.80424340151738, -1.86097024450742 51.80392489192828, -1.86093799498872 51.80377857895609, -1.86146368909299 51.8035662743228, -1.86236487898602 51.80315499374279, -1.86256879655551 51.80322798465446, -1.86267605540044 51.80340046270888, -1.86286919318652 51.80357327339249, -1.86315881003412 51.80373247416248))'), {u'source': u'openstreetmap.org', u'way_area': u'62777.7', u'natural': u'wood', u'name': u'The Far Covert'}))  # noqa

        self.assert_no_matching_feature(
            14, 8107, 5426, 'pois',
            {'id': 249171216, 'kind': 'natural_wood'})

        # Label placement natural: wood in landuse
        self.assert_has_feature(
            15, 16214, 10852, 'landuse',
            {'id': 249171216, 'kind': 'natural_wood', 'label_placement': True})

    def test_natural_wood_node(self):
        # Node:369162231 natural: wood in POIS
        # note: since #1103, there should be no POIs for natural_wood, only
        # label placements in the landuse layer.
        self.generate_fixtures(dsl.way(369162231, wkt_loads('POINT (-122.595261824757 38.36685750191948)'), {u'natural': u'wood', u'name': u'Coppers Grove', u'gnis:feature_type': u'Woods', u'addr:state': u'CA', u'ele': u'295', u'source': u'openstreetmap.org', u'gnis:created': u'01/19/1981', u'gnis:feature_id': u'221546', u'gnis:county_name': u'Sonoma'}))  # noqa

        self.assert_no_matching_feature(
            14, 2612, 6298, 'pois',
            {'id': 369162231, 'kind': 'natural_wood'})

    def test_works_way(self):
        # works in POIS
        self.generate_fixtures(dsl.way(161371157, wkt_loads('POLYGON ((-1.76631009178027 51.57162087992249, -1.76566078949291 51.57174159182719, -1.76568010327152 51.57178190350198, -1.76514452769913 51.571881398369, -1.76506736241622 51.57172087764248, -1.76533335357185 51.5716714650613, -1.76530415832511 51.57161077405469, -1.76547654502814 51.5715786697636, -1.7655058301064 51.57163958414699, -1.76571190363258 51.5716012823536, -1.765689535582 51.57155466132238, -1.76587162409009 51.5715207703152, -1.7658422491803 51.57145957660399, -1.76610401825409 51.5714110012454, -1.76613366265847 51.57147236252309, -1.76623014171998 51.5714544957356, -1.76631009178027 51.57162087992249))'), {u'building': u'yes', u'source': u'openstreetmap.org', u'way_area': u'4682.42', u'man_made': u'works', u'name': u'Seqol Enterprise Works'}))  # noqa

        self.assert_has_feature(
            14, 8111, 5443, 'pois',
            {'id': 161371157, 'kind': 'works', 'min_zoom': 14})

        # Label placement works in landuse
        self.assert_no_matching_feature(
            14, 8111, 5443, 'landuse',
            {'id': 161371157, 'kind': 'works', 'label_placement': True})

    def test_works_node(self):
        # Node:1004981713 works in POIS
        self.generate_fixtures(dsl.way(1004981713, wkt_loads('POINT (-107.628115297882 37.8287874806088)'), {u'source': u'openstreetmap.org', u'man_made': u'works', u'name': u'Mayflower Mill'}))  # noqa

        self.assert_has_feature(
            14, 3293, 6329, 'pois',
            {'id': 1004981713, 'kind': 'works', 'min_zoom': 14})
